#ifndef __DRV_SYSTICK_H
#define __DRV_SYSTICK_H

#ifdef __cplusplus
extern "C" {
#endif

#include "mm32_device.h"
#include "hal_conf.h"

#define TMR_COUNT	4
enum
{
	TMR_ONCE_MODE = 0,
	TMR_AUTO_MODE = 1
};
#define ENABLE_INT()	__set_PRIMASK(0)
#define DISABLE_INT()	__set_PRIMASK(1)

typedef struct soft_tmr
{
	__IO uint8_t mode;
	__IO uint8_t flag;
	__IO uint32_t count;
	__IO uint32_t preLoad;
}soft_tmr;

void bsp_starttimer(uint8_t _id, uint32_t _period, uint8_t mode);
void bsp_stoptimer(uint8_t _id);
uint8_t bsp_checktimer(uint8_t _id);
int32_t bsp_getruntime(void);
int32_t bsp_checkruntime(int32_t lasttime);
void bsp_delayus(uint32_t n);
void bsp_delayms(uint32_t n);
void systick_init(void);


#ifdef __cplusplus
}
#endif


#endif

